//
//  WW_viewtool.m
//  yygroupon
//
//  Created by 谢世忠 on 15/5/23.
//  Copyright (c) 2015年 waste. All rights reserved.
//

#import "WW_viewtool.h"

@implementation WW_viewtool


+ (UILabel *)createLabel:(CGRect)frame andTextColor:(UIColor *)color
                 andText:(NSString *)text andFontsize:(CGFloat)fontsize
                andAlign:(NSTextAlignment)align Tag:(int)tag
{
    UILabel *nameLabel = [[UILabel alloc] init];
    nameLabel.backgroundColor = [UIColor clearColor];
    nameLabel.text = text;
    nameLabel.textColor = color;
    nameLabel.tag = tag;
    nameLabel.font = [UIFont systemFontOfSize:fontsize];
    nameLabel.frame = frame;
    nameLabel.textAlignment = align;
    return nameLabel;
}

+ (UIView *)createView:(CGRect)frame BackColor:(UIColor *)color Tag:(int)tag
{
    UIView *view = [[UIView alloc] initWithFrame:frame];
    view.backgroundColor = color;
    view.tag = tag;
    return view;
}

+ (UIButton *)createButton:(CGRect)frame Title:(NSString *)title
                TitleColor:(UIColor *)color Bgimage:(NSString *)imgname
                       Tag:(int)tag Font:(UIFont *)font
{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:color forState:UIControlStateNormal];
    [btn.titleLabel setFont:font];
    btn.frame = frame;
    [btn setBackgroundImage:[UIImage imageNamed:imgname] forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@_pressed",imgname]] forState:UIControlStateHighlighted];
    btn.tag = tag;
    return btn;
}

+(UILabel *)createLine:(CGRect)frame{
    UILabel *line=[[UILabel alloc] initWithFrame:frame];
    line.backgroundColor=UIColorFromRGB(0xdfdfdf);
    return line;
}
@end
